﻿using NUnit.Framework;
using Pyxis.FluentSelenium.Locator;
using Selenium;

namespace Pyxis.FluentSelenium.SampleWebAppTest.SimpleExamples
{
    [TestFixture]
    public class ImageTest
    {
        private WebApplication application;
        private User user;

        private static readonly ImageLocator googleLogo = ImageLocator.WithId("googleLogo");

        [SetUp]
        public void Setup()
        {
            application = new WebApplication(3000, "Pyxis.FluentSelenium.SampleWebApp");
            application.Start();

            var selenium = new DefaultSelenium("127.0.0.1", 4445, "*iexplore", "http://localhost:3000/");
            user = new User(selenium);
            user.Start();
        }

        [TearDown]
        public void TearDown()
        {
            user.Stop();
            application.Stop();
        }

        [Test]
        public void ShouldSeeGoogleLogo()
        {
            user.Goto("SimpleExamples/Image.aspx");
            user.For(googleLogo).ShouldSeeImage("google.jpg");
        }
    }
}
